﻿package mortal.game.view.signUp.view
{
    import com.mui.controls.*;
    import com.mui.core.*;
    import com.mui.display.*;
    import mortal.game.events.*;
    import mortal.game.mvc.*;
    import mortal.game.resource.*;
    import mortal.game.view.common.*;
    import mortal.game.view.signUp.data.*;
    import mortal.mvc.core.*;

    public class SignUpCategoryTag extends GSprite
    {
        private var _tagBg:ScaleBitmap;
        private var _selectedBg:ScaleBitmap;
        private var _tagText:GBitmap;
        private var _canTakeIcon:GBitmap;
        private var _data:SignUpCategoryData;
        private var _tabIndex:int;
        private var _tabType:String;
        private var _isSel:Boolean;

        public function SignUpCategoryTag()
        {
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this.mouseEnabled = true;
            this.mouseChildren = false;
            this._tagBg = UIFactory.bg(0, 0, 183, 57, this, ImagesConst.AchievemenListTabBtnBg);
            this._selectedBg = UIFactory.bg(-2, -2, 187, 61, this, ImagesConst.selectFilter);
            this._selectedBg.visible = false;
            this._tagText = UIFactory.gBitmap("", 32, 21, this);
            this._canTakeIcon = UIFactory.gBitmap(ImagesConst.ItemGetIcon, 0, 0, this);
            this._canTakeIcon.visible = false;
            return;
        }// end function

        public function set data(param1:SignUpCategoryData) : void
        {
            this._data = param1;
            if (param1)
            {
                this._tagText.bitmapData = GlobalClass.getBitmapData(param1.resName);
                this._tagText.x = param1.textXPos;
                this._tagText.y = param1.textYPos;
            }
            return;
        }// end function

        override public function set tabIndex(param1:int) : void
        {
            this._tabIndex = param1;
            return;
        }// end function

        override public function get tabIndex() : int
        {
            return this._tabIndex;
        }// end function

        public function set tabType(param1:String) : void
        {
            this._tabType = param1;
            return;
        }// end function

        public function get tabType() : String
        {
            return this._tabType;
        }// end function

        public function set isSel(param1:Boolean) : void
        {
            this._isSel = param1;
            if (param1)
            {
                this._selectedBg.visible = true;
            }
            else
            {
                this._selectedBg.visible = false;
            }
            return;
        }// end function

        public function set isShowArroundEffect(param1:Boolean) : void
        {
            var _loc_2:Object = {};
            _loc_2["tabIndex"] = this._tabIndex;
            _loc_2["y"] = this.y;
            _loc_2["isShowEffect"] = param1;
            Dispatcher.dispatchEvent(new DataEvent(EventName.SignUpUpdateTagEffectState, _loc_2));
            this._canTakeIcon.visible = param1;
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            super.disposeImpl(param1);
            this._tagBg.dispose(param1);
            this._selectedBg.dispose(param1);
            this._tagText.dispose(param1);
            this._canTakeIcon.dispose();
            this._tagBg = null;
            this._selectedBg = null;
            this._tagText = null;
            this._canTakeIcon = null;
            this._data = null;
            this._tabIndex = 0;
            this._isSel = false;
            return;
        }// end function

    }
}
